package com.dingtalk.dingbotmgr.action;

import java.util.List;

import com.dingtalk.dingbotmgr.message.TextMessage;
import com.dingtalk.dingbotmgr.model.ChatBot;
import com.dingtalk.dingbotmgr.model.ChatBotMessage;
import com.dingtalk.dingbotmgr.model.Task;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * Created by wyx on 2017/2/28.
 */
@Component("taskAction")
@Scope("prototype")
public class TaskAction extends BaseAction {

    private ChatBot chatBot;

    private List<ChatBot> chatBotList;

    private List<ChatBotMessage> chatBotMessageList;

    private ChatBotMessage chatBotMessage;

    private List<Task> taskList;

    private Task task;

    private List<Integer> chatBotIdList;

    private TextMessage textMessage;

    public String listTask() {
        taskList = taskService.list();
        chatBotList = chatBotService.list();
        chatBotMessageList = chatBotMessageService.list();
        return SUCCESS;
    }

    public String saveTask() {
        taskService.saveOrUpdate(task, textMessage, chatBotIdList);
        return SUCCESS;
    }

    public String deleteTask() {
        taskService.delete(task);
        return SUCCESS;
    }

    public ChatBot getChatBot() {
        return chatBot;
    }

    public void setChatBot(ChatBot chatBot) {
        this.chatBot = chatBot;
    }

    public List<ChatBot> getChatBotList() {
        return chatBotList;
    }

    public void setChatBotList(List<ChatBot> chatBotList) {
        this.chatBotList = chatBotList;
    }

    public List<ChatBotMessage> getChatBotMessageList() {
        return chatBotMessageList;
    }

    public void setChatBotMessageList(List<ChatBotMessage> chatBotMessageList) {
        this.chatBotMessageList = chatBotMessageList;
    }

    public ChatBotMessage getChatBotMessage() {
        return chatBotMessage;
    }

    public void setChatBotMessage(ChatBotMessage chatBotMessage) {
        this.chatBotMessage = chatBotMessage;
    }

    public List<Task> getTaskList() {
        return taskList;
    }

    public void setTaskList(List<Task> taskList) {
        this.taskList = taskList;
    }

    public Task getTask() {
        return task;
    }

    public void setTask(Task task) {
        this.task = task;
    }

    public TextMessage getTextMessage() {
        return textMessage;
    }

    public void setTextMessage(TextMessage textMessage) {
        this.textMessage = textMessage;
    }

    public List<Integer> getChatBotIdList() {
        return chatBotIdList;
    }

    public void setChatBotIdList(List<Integer> chatBotIdList) {
        this.chatBotIdList = chatBotIdList;
    }
}
